Skip to content

Simplify unfolds by reusing results of predicate verification#929

Merged
marcoeilers merged 18 commits into
masterfrom
meilers_reuse_predicate_heaps
Aug 28, 2025
Merged

Simplify unfolds by reusing results of predicate verification#929
marcoeilers merged 18 commits into
masterfrom
meilers_reuse_predicate_heaps

Conversation

@marcoeilers

@marcoeilers marcoeilers commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

Simplify executing unfolds and evaluating unfoldings by removing the need to fully produce the predicate body.
The idea (thanks @JonasAlaif!) is to reuse the result of verifying the predicate body's well-definedness: After doing so, we know the potential branches and the potential heaps we get from a predicate unfold. Thus, we can remember these heaps, the assumptions that came with them, as well as the declarations we made in the process, and simply declare them, assume them, and add them to our current heap when we are asked to unfold the predicate.

For now, this optimization is disabled by default, and can be turned on by using the new flag --enableSimplifiedUnfolds.

This requires:

  • Using the FunctionRecorder also while verifying a predicate, to collect all relevant declarations. This in turn required moving some code around between FunctionRecorder, FunctionData, and FunctionVerificationUnit, since the FunctionRecorder is now no longer only used for functions.
  • Storing a tree structure containing all heaps etc. under the respective branch conditions resulting from inhaling a predicate body after verifying the predicate
  • Adjusting the assumptions and heap chunks when doing the unfold (e.g., scaling permission amounts, replacing the snapshots with the actual snapshot of the unfolded predicate, and turning ordinary chunks into QP chunks)
  • Recording some additional information in the FunctionRecorder that was not previously required, like apparently permission maps.

@marcoeilers marcoeilers marked this pull request as ready for review August 27, 2025 12:14
@marcoeilers marcoeilers merged commit 14728c0 into master Aug 28, 2025
4 checks passed
@marcoeilers marcoeilers deleted the meilers_reuse_predicate_heaps branch August 28, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant